package com.tlxch.controller.teacher;

import com.tlxch.pojo.SClass;
import com.tlxch.pojo.ScGrades;
import com.tlxch.result.Result;
import com.tlxch.server.teacher.TSclassService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "课程相关接口")
@Slf4j
@RestController
@RequestMapping("/teacher/class")
public class TSclassController {
    @Autowired
    TSclassService tSclassService;

    @PostMapping("/add")
    @ApiOperation("新增课程")
    public Result addClassAndGrade(@RequestBody SClass sClass){
        tSclassService.addClassAndGrade(sClass);
        return Result.success();
    }

    @GetMapping("/getstulistbytid")
    @ApiOperation("根据教师id查询课程列表")
    public Result<List<ScGrades>> getStuListByTid(String Tid){
        List<ScGrades> scGradesList = tSclassService.getStuListByTid(Tid);
        return Result.success(scGradesList);
    }
}
